package com.cqxyd.smartsite.controller;

import com.alibaba.fastjson.JSONObject;
import com.cqxyd.smartsite.pojo.AdminInfo;
import com.cqxyd.smartsite.pojo.UploadRecordVo;
import com.cqxyd.smartsite.service.LoginService;
import com.cqxyd.smartsite.service.UploadRecordService;
import com.cqxyd.smartsite.util.KeyValueUtil;
import com.cqxyd.smartsite.util.MD5Helper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @ClassName: HospitalInfoController
 * @Description: 上传记录控制层
 * @author Angus
 * @date 2018-11-21
 */
@Controller
@ApiIgnore
@RequestMapping(value = "/uploadRecord")
public class UploadRecordController {

	@Autowired
	private UploadRecordService uploadRecordService;

	@RequestMapping(value = "/list")
	public String showList(Model model) {

		model.addAttribute("deviceTypes", KeyValueUtil.getDeviceTypes());
		return "uploadRecord/uploadRecord-list";
	}

	@RequestMapping(value = "/uploadRecordList")
	@ResponseBody
	public String getRegInfoList(Integer pageNum, Integer pageSize,String serialNo, String deviceType, String timeStart, String timeEnd) {

		PageInfo<UploadRecordVo> payInfoList = uploadRecordService.getUploadRecordListByPage(pageNum, pageSize, serialNo,
				deviceType, timeStart, timeEnd);
		JSONObject result = new JSONObject();
		result.put("rows", payInfoList.getList());
		result.put("total", payInfoList.getTotal());
		return result.toJSONString();
	}
}
